import Vue from "vue"
import router from "@/router"
import store from '@/store'
export default{
    // 是否登录验证方法
    mustBeLogin(){
        let token = localStorage.getItem('token')
        if(!token){
            Vue.prototype.$toast('请先登录')
            
            // 调用store(vuex)中的方法，改变isGoBack
            // console.log(store['_mutations']['isGoBack/chanIsGoBack'][0])
            store['_mutations']['isGoBack/chanIsGoBack'][0](true)
            setTimeout(()=>{
                router.push('/user')
            },1000)
            return 
        }
 
        return true
    }
}